package pub.guoxin.oops.manager.controller;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pub.guoxin.oops.constants.OopsPathConstants;
import pub.guoxin.oops.vo.ResultVo;
import pub.guoxin.oops.vo.ResultVoBuilder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by guoxin on 18-2-3.
 */
@Slf4j
@RestController
@RequestMapping(OopsPathConstants.TIMESTAMP_PATH)
public class TimestampController {
    @Autowired
    private ResultVoBuilder builder;

    @ApiOperation(value = "查询分组", notes = "查询分组(分页查询所有分组，权限：公司管理员)")
    @GetMapping(value = "/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultVo<Long> get() {
        long timestamp = System.currentTimeMillis();
        Date date = new Date(timestamp);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = sdf.format(date);
        log.info("当前时间" + format);
        return builder.buildSuccessResultInfo(timestamp);
    }
}
